home *** CD-ROM | disk | FTP | other *** search
/ The CICA Windows Explosion! / The CICA Windows Explosion! - Disc 2.iso / programr / upc12bs1.zip / UUCICO / commlib.h < prev    next >
C/C++ Source or Header  |  1993-10-02  |  7KB  |  176 lines

  1. #ifndef COMMLIB_H
  2. #define COMMLIB_H
  3.  
  4. /*--------------------------------------------------------------------*/
  5. /*       c o m m l i b . h                                            */
  6. /*                                                                    */
  7. /*       Generic communications library interface for UUPC/extended.  */
  8. /*--------------------------------------------------------------------*/
  9.  
  10. /*--------------------------------------------------------------------*/
  11. /*    Changes Copyright (c) 1990-1993 by Kendra Electronic            */
  12. /*    Wonderworks.                                                    */
  13. /*                                                                    */
  14. /*    All rights reserved except those explicitly granted by the      */
  15. /*    UUPC/extended license agreement.                                */
  16. /*--------------------------------------------------------------------*/
  17.  
  18. /*--------------------------------------------------------------------*/
  19. /*                          RCS Information                           */
  20. /*--------------------------------------------------------------------*/
  21.  
  22. /*
  23.  *    $Id: commlib.h 1.7 1993/10/02 23:51:15 ahd Exp $
  24.  *
  25.  *    Revision history:
  26.  *    $Log: commlib.h $
  27.  * Revision 1.7  1993/10/02  23:51:15  ahd
  28.  * Reduce MAXPACK for 32 bit environments to 1024 bytes because
  29.  * of NT aborts  with 4096
  30.  *
  31.  * Revision 1.6  1993/09/29  04:56:11  ahd
  32.  * Suspend port by port name, not modem file name
  33.  *
  34.  * Revision 1.5  1993/09/25  03:13:04  ahd
  35.  * Add priority altering prototypes
  36.  *
  37.  * Revision 1.4  1993/09/21  01:43:46  ahd
  38.  * Move MAXPACK to commlib.h to allow use as standard comm buffer size
  39.  *
  40.  * Revision 1.3  1993/09/20  04:53:57  ahd
  41.  * TCP/IP support from Dave Watt
  42.  * 't' protocol support
  43.  * OS/2 2.x support (BC++ 1.0 for OS/2 support)
  44.  *
  45.  * Revision 1.2  1993/05/30  15:27:22  ahd
  46.  * Additional multiple comm driver support
  47.  *
  48.  * Revision 1.1  1993/05/30  00:11:03  ahd
  49.  * Initial revision
  50.  *
  51.  */
  52.  
  53. /*--------------------------------------------------------------------*/
  54. /*       Declare pointers to the functions we use the                 */
  55. /*       communications driver                                        */
  56. /*--------------------------------------------------------------------*/
  57.  
  58. typedef int (*commrefi)();
  59. typedef unsigned int (*commrefu)();
  60. typedef void    (*commrefv)();
  61. typedef boolean (*commrefb)();
  62. typedef BPS     (*commrefB)();
  63.  
  64. /*--------------------------------------------------------------------*/
  65. /*         Define table for looking up communications functions       */
  66. /*--------------------------------------------------------------------*/
  67.  
  68. typedef struct _COMMSUITE {
  69.         char     *type;
  70.         commrefi activeopenline;
  71.         commrefi passiveopenline;
  72.         commrefu sread;
  73.         commrefi swrite;
  74.         commrefv ssendbrk, closeline, SIOSpeed, flowcontrol, hangup;
  75.         commrefB GetSpeed;
  76.         commrefb CD;
  77.         commrefb WaitForNetConnect;
  78.         boolean  network;
  79. } COMMSUITE;
  80.  
  81. /*--------------------------------------------------------------------*/
  82. /*       Define function to select communications driver functions;   */
  83. /*       returns TRUE on success.                                     */
  84. /*--------------------------------------------------------------------*/
  85.  
  86. boolean chooseCommunications( const char *suite );
  87.  
  88. boolean IsNetwork(void);         // Report if suite is network oriented
  89.  
  90. /*--------------------------------------------------------------------*/
  91. /*       Trace functions for communications routines                  */
  92. /*--------------------------------------------------------------------*/
  93.  
  94. boolean traceStart( const char *port );
  95.  
  96. void traceStop( void );
  97.  
  98. void traceData( const char *data,
  99.                 const short len,
  100.                 const boolean output);
  101.  
  102. /*--------------------------------------------------------------------*/
  103. /*           Declare the functions used by various routines           */
  104. /*--------------------------------------------------------------------*/
  105.  
  106. extern int (*activeopenlinep)(char *name, BPS baud, const boolean direct);
  107.  
  108. extern int (*passiveopenlinep)(char *name, BPS baud, const boolean direct);
  109.  
  110. extern unsigned int (*sreadp)(char *buffer,
  111.                           unsigned int wanted,
  112.                           unsigned int timeout);
  113.  
  114. extern int (*swritep)(const char *data, unsigned int len);
  115.  
  116. extern void (*ssendbrkp)(unsigned int duration);
  117.  
  118. extern void (*closelinep)(void);
  119.  
  120. extern void (*SIOSpeedp)(BPS baud);
  121.  
  122. extern void (*flowcontrolp)( boolean );
  123.  
  124. extern void (*hangupp)( void );
  125.  
  126. extern BPS (*GetSpeedp)( void );
  127.  
  128. extern boolean (*CDp)( void );
  129.  
  130. extern boolean (*WaitForNetConnectp)( const unsigned int timeout);
  131.  
  132. /*--------------------------------------------------------------------*/
  133. /*       Declare macros which define the prev-generic driver names    */
  134. /*       (and are easier to type).                                    */
  135. /*--------------------------------------------------------------------*/
  136.  
  137. #define activeopenline(name, baud, direct) (*activeopenlinep)(name, baud, direct)
  138. #define passiveopenline(name, baud, direct)(*passiveopenlinep)(name, baud, direct)
  139. #define sread(buffer, wanted, timeout) (*sreadp)(buffer, wanted, timeout)
  140. #define swrite(buffer, wanted)         (*swritep)(buffer, wanted )
  141. #define ssendbrk( duration )           (*ssendbrkp)(duration)
  142. #define closeline()                    (*closelinep)()
  143. #define flowcontrol(onoroff)           (*flowcontrolp)(onoroff)
  144. #define SIOSpeed(baud)                 (*SIOSpeedp)(baud)
  145. #define hangup()                       (*hangupp)()
  146. #define GetSpeed()                     (*GetSpeedp)()
  147. #define CD()                           (*CDp)()
  148. #define WaitForNetConnect(timeout)     (*WaitForNetConnectp)(timeout)
  149.  
  150. extern boolean portActive;          // Port active flag for error handler
  151. extern boolean traceEnabled;        // Enable comm port trace
  152.  
  153. boolean IsNetwork(void);
  154.  
  155. /*--------------------------------------------------------------------*/
  156. /*                     Priority setting functions                     */
  157. /*--------------------------------------------------------------------*/
  158.  
  159. void setPrty( const KEWSHORT priorityIn, const KEWSHORT prioritydeltaIn );
  160.  
  161. void resetPrty( void );
  162.  
  163. /*--------------------------------------------------------------------*/
  164. /*                    Declare network buffer size                     */
  165. /*--------------------------------------------------------------------*/
  166.  
  167. #if defined(__OS2__) || defined(WIN32) // 32 bit compiler?
  168. #define MAXPACK 1024          /* Max packet size we can handle       */
  169. #elif defined(_Windows)
  170. #define MAXPACK 1024          /* Needed for 't' protocol blocks      */
  171. #else
  172. #define MAXPACK 512           /* Max packet size we can handle       */
  173. #endif
  174.  
  175. #endif
  176.